package ui.filter;

import java.util.Calendar;

import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerFilter;

import dao.EgnRstScenarioId;


public class StringArrayFilter extends ViewerFilter {
	private String searchString;

	public void setSearchText(String s) {
		// Search must be a substring of the existing value
		this.searchString = ".*" + s + ".*";
		
	}
	
	@Override
	public boolean select(Viewer viewer, Object parentElement, Object element) {
		Object[] rst = (Object[])element;
		if (searchString == null || searchString.length() == 0) {
			return true;
		}
		for (int i =0 ;i<rst.length; i++){
			if (rst[i] instanceof String && ((String)rst[i]).toUpperCase().matches(searchString.toUpperCase())) {
				return true;
			}
		}
		return false;

	}

}
